package com.xx.xunyou.serviceImpl;

import com.xx.xunyou.dao.item.comment.XunyouCommentDAO;
import com.xx.xunyou.entity.item.comment.XunyouComment;
import com.xx.xunyou.service.XunyouCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @program: xunyou-parent
 * @author: zhl
 * @create: 2019-05-20
 **/
@Service
public class XunyouCommentServiceImpl implements XunyouCommentService {

    @Autowired
    private XunyouCommentDAO xunyouCommentDAO;

    @Override
    @Transactional
    public void insert(Integer userId, Integer objectId, Integer typeId, String content) {
        XunyouComment xunyouComment = new XunyouComment();
        xunyouComment.setContent(content);
        xunyouComment.setCreateTime(new Date());
        xunyouComment.setObjectId(objectId);
        xunyouComment.setTypeId(typeId);
        xunyouComment.setUserId(userId);
        xunyouCommentDAO.insertSelective(xunyouComment);
    }
}
